package com.briup.day05;

import java.util.Scanner;

/**
 * @author ThinkBook
 */
public class Test04_If {
    //if第一种形式：闰年判断
    public static void main01(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入一个年份: ");
        int year = sc.nextInt();

        //闰年判断
        if((year % 4 == 0 && year % 100 != 0)
                || (year % 400 == 0)) {
            System.out.println(year + " 是闰年!");
        }
        System.out.println("after if 语句...");
    }

    public static void main(String[] args) {
        //if第三种形式：if{}else if{} ... else{}
        // 从键盘录入一个成绩，输出其对应的等级

            Scanner sc = new Scanner(System.in);

            System.out.println("请输入一个成绩值[0-100]: ");
            int score = sc.nextInt();

            if(score >= 90 && score <= 100) {
                System.out.println("优秀");
            }else if(score >= 80 && score <= 89){
                System.out.println("良好");
            }else if(score >= 70 && score <= 79){
                System.out.println("中等");
            }else if(score >= 60 && score <= 69){
                System.out.println("及格");
            }else if(score >= 0 && score <= 59) {
                System.out.println("不及格");
            }else {
                System.out.println("输入数据有误");
            }
        }
    }

